<#
 #   It is recommended to test the script on a local machine for its purpose and effects. 
 #   ManageEngine Endpoint Central will not be responsible for any 
 #   damage/loss to the data/setup based on the behavior of the script.

 #   Description: Script is designed To copy a file to a user based location via computer based deployment
 #   Configuration Type - COMPUTER
 #   Dependency File - Upload the file and update the file name accordingly in the script.
 #   Note: Update the destination path in the destination path and file name to be hardcoded in the script.

 #>

# Get the current username from the system
$name = (Get-WMIObject -Class Win32_ComputerSystem).Username
$username = $name.Split("\")[1]

# Define the user's profile path
$userprofilepath = "C:\Users\$username"

# Specify the source and destination file paths
$source = "file.txt"  # Example file need to be changed 
$destination = "$userprofilepath\destinationpath"  # Destination file path needs to be hardcoded

# Check if the source file exists before copying
if (Test-Path $source) {
    Copy-Item -Path $source -Destination $destination -Force
    Write-Host "File copied successfully."
} else {
    Write-Host "Source file does not exist."
}